package imvu.rbox.object
{
	import flash.display.MovieClip;
	import flash.display.Sprite;
	
	import imvu.rbox.event.BoxEvent;

	public class BoxMovie extends MovieClip
	{
		public var mcFire:Sprite;
		
		public function BoxMovie()
		{
			this.mcFire.mouseChildren = this.mcFire.mouseEnabled = false;
			
			this.id = 0;			
		}
		
		public function set id(num:Number):void
		{
			var fm:int;
		
			if(num > 0)
			{
				if(num == BoxEvent.BOX_FLY)
				{
					fm = this.totalFrames;
				}
				else
				{
					fm = Math.floor(Math.floor(num) % Number(this.totalFrames - 1)) + 2;
					if(fm == this.totalFrames)
					{
						fm = this.totalFrames - 1;
					}					
				}
			}
			else
			{
				fm = 1;
			}
			
			this.isFire = false;

			this.gotoAndStop(fm);
		}
		
		public function get id():Number
		{
			return this.currentFrame - 1;
		}
		
		public function set isFire(flag:Boolean):void
		{
			this.mcFire.visible = flag;
		}				
	}
}